from abc import ABCMeta, abstractmethod


class Handler(metaclass=ABCMeta):
    @abstractmethod
    def handle_leave(self):
        pass

class GeneralManager(Handler):
    def handle_leave(self,day):
        if day<15:
            print("总经理批准请假")
        else:
            print("请假太多了，你离职吧")



class  DepartmentManager(Handler):
    def __init__(self):
        self.next = GeneralManager()
    def handle_leave(self,day):
        if day <=5:
            print("部门经理批注请假")
        else:
            print("部门经理权限不足")
            self.next.handle_leave(day)



class ProjectManager(Handler):
    def __init__(self):
        self.next = DepartmentManager()

    def handle_leave(self,day):
        if day<=3:
            print("项目经理批准")
        else:
            print("项目经理权限不足")
            self.next.handle_leave(day)



day = 17
obj = ProjectManager()
obj.handle_leave(day)